package com.ramos.kuaixiao;

import android.content.Context;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.mob.MobSDK;
import com.ramos.kuaixiao.db.DBHelper;
import com.ramos.kuaixiao.entity.Customer;
import com.ramos.kuaixiao.entity.FindOrderDetail;
import com.ramos.kuaixiao.entity.ShopTypeBean;
import com.ramos.kuaixiao.utils.CrashHandler;
import com.ramos.kuaixiao.utils.SharedPreference;
import com.tencent.stat.StatConfig;
import com.tencent.stat.StatService;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class App extends android.support.multidex.MultiDexApplication{
    public static Context mContext;
    public static String mUserId;
    public static boolean mIsZipData = true;
    public static boolean mIsUpdate = true;
    public static boolean mIsLocalData = true;
    public static boolean mIsDebug = false;
    public static boolean mUserChanged = false;
    public static boolean mIsShopClient = true;
    public static boolean isAllShops = false;
    public static String CUSTOMER_RESULT;
    public static String WARE_RESULT;
    public static String SHOP_RESULT;
    public static String ORDER_RESULT;
    public static String APK_URL = "";
    public static String selectName = "";
    public static final DecimalFormat df = new DecimalFormat("######0.00");
    public static final DecimalFormat df1 = new DecimalFormat("######0");
    public static final long DELAY_TIME = 50000;
    public static Map<String, String> mImages = new HashMap<>();
    public static List<ShopTypeBean.ShopType.ProductInfo> mProductInfos = new ArrayList<>();
    public static List<Customer> mCustomerList = new ArrayList<>();
    public static List<FindOrderDetail> mOrderList = new ArrayList<>();
    public static Map<String, String> mAllShopTypes = new HashMap<>();
    public static int mShowDialog = 0;
    public final static String DOWNLOAD_NAME = "dbinfo.7z";
    public static String ZipUrl = "";
    public static boolean isStoreNumUpdating = false;
    public static boolean isOrderUpdating = false;

    public static boolean isEmpBrandUpdating = false;
    public static boolean isEmpStorehouseUpdating = false;
    public static boolean isShopsUpdating = false;
    public static boolean isProductTypeUpdating = false;
    public static boolean isBrandKeywordUpdating = false;

    public static boolean isPriceTypeUpdating = false;
    public static boolean isProductPriceUpdating = false;
    public static boolean isProductBrandUpdating = false;
    public static boolean isStoreHouseUpdating = false;
    public static boolean isClientPriceUpdating = false;
    public static boolean isCustomerUpdating = false;
    public static boolean isCustomerStoreUpdating = false;
    public static boolean isSaleCustomerUpdating = false;
    public static boolean isSaleCustomerStoreUpdating = false;

    public static boolean isOldVersion = false;
    public static final int PAGE_NUM = 1000;
    @Override
    public void onCreate() {
        super.onCreate();
        mContext = getApplicationContext();
        mUserId = SharedPreference.getPreferString("id");
        Fresco.initialize(mContext);
        MobSDK.init(this);

        Thread.setDefaultUncaughtExceptionHandler(
                CrashHandler.getInstance(getApplicationContext()));

        // [可选]设置是否打开debug输出，上线时请关闭，Logcat标签为"MtaSDK"
        if (BuildConfig.DEBUG) {
            StatConfig.setDebugEnable(true);
        } else {
            StatConfig.setDebugEnable(false);
        }
        // 基础统计API
        StatService.registerActivityLifecycleCallbacks(this);
    }
}